import 'package:gameplay_flutter/generated/json/base/json_convert_content.dart';
import 'package:gameplay_flutter/lib_basemodel/country/country_model.dart';

CountryModel $CountryModelFromJson(Map<String, dynamic> json) {
  final CountryModel countryModel = CountryModel();
  final String? country = jsonConvert.convert<String>(json['country']);
  if (country != null) {
    countryModel.country = country;
  }
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    countryModel.code = code;
  }
  final String? countryCode = jsonConvert.convert<String>(json['countryCode']);
  if (countryCode != null) {
    countryModel.countryCode = countryCode;
  }
  final String? flag = jsonConvert.convert<String>(json['flag']);
  if (flag != null) {
    countryModel.flag = flag;
  }
  return countryModel;
}

Map<String, dynamic> $CountryModelToJson(CountryModel entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['country'] = entity.country;
  data['code'] = entity.code;
  data['countryCode'] = entity.countryCode;
  data['flag'] = entity.flag;
  return data;
}

extension CountryModelExtension on CountryModel {
  CountryModel copyWith({
    String? country,
    String? code,
    String? countryCode,
    String? flag,
  }) {
    return CountryModel()
      ..country = country ?? this.country
      ..code = code ?? this.code
      ..countryCode = countryCode ?? this.countryCode
      ..flag = flag ?? this.flag;
  }
}
